/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2022-04-21
 * Time: 22:47
 */
public class test {
    public static int countTriplets(int[] arr) {
        int count=0;
        int a=0;
        int b=0;

        for(int i=0;i<arr.length;i++){
            for(int j=i+1;j<arr.length;j++){
                for(int k=j;k<arr.length;k++){
                    for(int t=i;t<=j-1;t++){
                        a^=arr[t];
                    }
                    for(int r=j;r<=k;r++){
                        b^=arr[r];
                    }
                    if(a==b){
                        count++;
                        System.out.println(i+" "+j+" "+k);
                    }
                }
            }
        }
        return count;
    }

    public static void main(String[] args) {
        int[] arr={2,3,1,6,7};
        int count=countTriplets(arr);
    }
}
